package com.cy.pj.sys.controller;

import com.cy.com.cy.pj.pojo.JsonResult;
import com.cy.pj.sys.pojo.SysMenu;
import com.cy.pj.sys.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/menu")
public class SysMenuController {
    @Autowired
    private SysMenuService sysMenuService;

    //菜单管理
    @RequestMapping("/doFindObjects")
    public JsonResult doFindObjects(){
        return new JsonResult(sysMenuService.findObjects());
    }

    //上级菜单展现
    @RequestMapping("/doFindZtreeMenuNodes")
    public JsonResult doFindZtreeMenuNodes(){
        return new JsonResult(sysMenuService.findZtreeMenuNodes());
    }

    //添加菜单数据
    @RequestMapping("/doSaveObject")
    public JsonResult doSaveObject(SysMenu sysMenu){
        sysMenuService.saveObject(sysMenu);
        return new JsonResult("添加成功！");
    }

    //修改菜单数据
    @RequestMapping("/doUpdateObject")
    public JsonResult doUpdateObject(SysMenu sysMenu){
        sysMenuService.updateObject(sysMenu);
        return new JsonResult("修改成功");
    }

}
